package lab03.test13;

import java.sql.*;

/**
 * Created by dell on 2017/11/27.
 */
public class Test {
    public static void main(String[] args) {
        //加载驱动
        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;
        //表名字：t_users
        String sql = "insert into t_users(id,username,password) values(1,'li','123')";

        try {
            try {
                connection = DriverManager.getConnection(
                        "jdbc:mysql://localhost:3306/sctu?serverTimezone=UTC",
                        "root",
                        "123456"
                );
            } catch (SQLException e) {
                e.printStackTrace();
            }
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
